﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Controls.Primitives;

namespace iTFF.WPF.UI
{
    public static class ControlBehaviours
    {

        #region Mouse double click

        public static readonly DependencyProperty DoubleClickCommand = EventBehaviourFactory.CreateCommandExecutionEventBehaviour(
            Control.MouseDoubleClickEvent, 
            "DoubleClickCommand", 
            typeof (ControlBehaviours));

        public static void SetDoubleClickCommand(Control o, ICommand command)
        {
            o.SetValue(DoubleClickCommand, command);
        }

        public static void GetDoubleClickCommand(Control o)
        {
            o.GetValue(DoubleClickCommand);
        }

        #endregion

        #region SizeChanged

        public static readonly DependencyProperty SizeChangedCommand = EventBehaviourFactory.CreateCommandExecutionEventBehaviour(
            FrameworkElement.SizeChangedEvent,
            "SizeChangedCommand",
            typeof(ControlBehaviours));

        public static void SetSizeChangedCommand(FrameworkElement o, ICommand command)
        {
            o.SetValue(SizeChangedCommand, command);
        }

        public static void GetSizeChangedCommand(FrameworkElement o)
        {
            o.GetValue(SizeChangedCommand);
        }

        #endregion

        #region Loaded

        public static readonly DependencyProperty LoadedCommand = EventBehaviourFactory.CreateCommandExecutionEventBehaviour(
            FrameworkElement.LoadedEvent,
            "LoadedCommand",
            typeof(ControlBehaviours));

        public static void SetLoadedCommand(FrameworkElement o, ICommand command)
        {
            o.SetValue(LoadedCommand, command);
        }

        public static void GetLoadedCommand(FrameworkElement o)
        {
            o.GetValue(LoadedCommand);
        }

        #endregion

        #region PreviewKeyDown

        public static readonly DependencyProperty PreviewKeyDownCommand = EventBehaviourFactory.CreateCommandExecutionEventBehaviour(
            UIElement.PreviewKeyDownEvent,
            "PreviewKeyDownCommand",
            typeof(ControlBehaviours));

        public static void SetPreviewKeyDownCommand(UIElement o, ICommand command)
        {
            o.SetValue(PreviewKeyDownCommand, command);
        }

        public static void GetPreviewKeyDownCommand(UIElement o)
        {
            o.GetValue(PreviewKeyDownCommand);
        }

        #endregion

        #region MouseEnter

        public static readonly DependencyProperty MouseEnterCommand = EventBehaviourFactory.CreateCommandExecutionEventBehaviour(
            UIElement.MouseEnterEvent,
            "MouseEnterCommand",
            typeof(ControlBehaviours));

        public static void SetMouseEnterCommand(UIElement o, ICommand command)
        {
            o.SetValue(MouseEnterCommand, command);
        }

        public static void GetMouseEnterCommand(UIElement o)
        {
            o.GetValue(MouseEnterCommand);
        }

        #endregion

        #region MouseLeave

        public static readonly DependencyProperty MouseLeaveCommand = EventBehaviourFactory.CreateCommandExecutionEventBehaviour(
            UIElement.MouseLeaveEvent,
            "MouseLeaveCommand",
            typeof(ControlBehaviours));

        public static void SetMouseLeaveCommand(UIElement o, ICommand command)
        {
            o.SetValue(MouseLeaveCommand, command);
        }

        public static void GetMouseLeaveCommand(UIElement o)
        {
            o.GetValue(MouseLeaveCommand);
        }

        #endregion

        #region MouseDown

        public static readonly DependencyProperty MouseDownCommand = EventBehaviourFactory.CreateCommandExecutionEventBehaviour(
            UIElement.MouseDownEvent,
            "MouseDownCommand",
            typeof(ControlBehaviours));

        public static void SetMouseDownCommand(UIElement o, ICommand command)
        {
            o.SetValue(MouseDownCommand, command);
        }

        public static void GetMouseDownCommand(UIElement o)
        {
            o.GetValue(MouseDownCommand);
        }

        #endregion

    }
}
